package com.happok.onlineclass.usermanagement.user.controller;

import com.happok.onlineclass.usermanagement.user.dto.UserSimpleDTO;
import com.happok.onlineclass.usermanagement.user.service.ManageUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户管理
 * 功能说明
 *
 * @author : chenac
 * @module 在线课堂/用户管理
 * @date : 2021/9/23 13:58
 */
@RestController
@Api(tags = "用户管理")
@RequestMapping(value = "/user-management")
public class FrontUesrController {

    @Autowired
    private ManageUserService manageUserService;

    /**
     * 用户id列表查询用户
     * 用户id列表查询用户 <br>
     * 20000,查询用户列表成功 <br>
     * 50000,服务端异常
     *
     * @param userIds 查询的用户id
     * @author: chenac
     * @date:  13:59
     * @execption:
     * @return: java.util.List<com.happok.onlineclass.usermanagement.user.dto.UserSimpleDTO>
     */
    @GetMapping(value = "/users/batch/v1")
    @ApiOperation(value = "用户id列表查询用户")
    @ApiResponses({
            @ApiResponse(code = 20000, message = "查询用户列表成功"),
            @ApiResponse(code = 50000, message = "服务端异常")
    })
    public List<UserSimpleDTO> listUser(@RequestParam(value = "userIds", required = true) List<Integer> userIds) {
        return manageUserService.listUser(userIds);
    }
}